package com.diandi.ddsb.manager.impl;

import com.diandi.ddsb.bean.Staff;
import com.diandi.ddsb.manager.StaffManager;
import com.diandi.ddsb.mapper.CenterStaffDao;
import com.diandi.ddsb.vo.StaffDto;
import com.diandi.ddsb.vo.StaffVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;


/**
 * 员工管理
 */
@Component
public class StaffManagerImpl implements StaffManager {

    @Autowired
    private CenterStaffDao staffDao;

    /**
     * 新增用户信息
     */
    @Override
    public int insertStaff(Staff staff) {
        return staffDao.insertStaff(staff);
    }



    /**
     * 修改用户信息
     *
     * @return
     */
    @Override
    public int updateStaff(Staff staff) {
        return staffDao.updateStaff(staff);
    }



    /**
     * 管理员修改用户信息
     *
     * @param staff
     * @return
     */
    @Override
    public int updateStaffAdmin(Staff staff) {
        return staffDao.updateStaffAdmin(staff);
    }



    /**
     * 删除用户信息
     *
     * @return
     */
    @Override
    public void deleteStaff(Long id) {
        staffDao.deleteStaff(id);
    }



    /**
     * 根据id查询用户信息
     *
     * @return
     */
    @Override
    public Staff findStaff(Long id) {
        return staffDao.findStaff(id);
    }



    /**
     * 根据名称查询用户信息
     *
     * @param name
     * @return
     */
    @Override
    public List<StaffDto> findStaffByNickname(String name) {
        return staffDao.findStaffByNickname(name);
    }



    /**
     * 查询所有用户信息
     *
     * @return
     */
    @Override
    public List<StaffDto> findAllStaff(Map paramMap) {
        return staffDao.findAllStaff(paramMap);
    }



    /**
     * 根据email查询管理用户
     *
     * @return
     */
    @Override
    public Staff findByNickname(String nickname) {
        return staffDao.findByNickname(nickname);
    }



    /**
     * 根据email查询管理用户
     *
     * @return
     */
    @Override
    public StaffDto findStaffVoByEmail(String email) {
        return staffDao.findStaffVoByEmail(email);
    }



    /**
     * 更新密码
     *
     * @param staff
     * @return
     */
    @Override
    public int updateStaffPassword(Staff staff) {
        return staffDao.updateStaffPassword(staff);
    }


    /**
     * 根据条件查询用户
     *
     * @param condition
     * @return
     */
    @Override
    public List<StaffDto> findStaffByCondition(Map condition) {
        return staffDao.findStaffByCondition(condition);
    }



    @Override
    public int updateStaffPassword(long id, String password) {
        return staffDao.updateStaffPassword(id, password);
    }



    /**
     * 根据角色查询用户
     *
     * @param roleId
     * @return
     */
    @Override
    public List<StaffDto> findStaffByRoleId(long roleId) {
        return staffDao.findStaffByRoleId(roleId);
    }



    /**
     * 获取后台用户管理条数
     *
     * @param paramMap
     * @return
     */
    @Override
    public Integer getStaffVoCount(Map paramMap) {
        return staffDao.getStaffVoCount(paramMap);
    }

    /**
     * 更新staff信息
     *
     * @param email
     * @param id
     * @return
     */
    @Override
    public Integer findStaffByEmailAndNotId(String email, Long id) {
        return staffDao.findStaffByEmailAndNotId(email, id);
    }


    /**
     * 获取符合条件的机构人员列表
     *
     * @param paramMap
     * @return
     */
    @Override
    public List<StaffVo> queryPrivStaffVo(Map paramMap) {

        return staffDao.getPrivStaffVo(paramMap);
    }

    /**
     * 根据属性查询机构人员
     *
     * @return
     */
    @Override
    public Staff findStaffByProperty(Map paramMap) {
        return staffDao.findStaffByProperty(paramMap);
    }

    /**
     * 查询机构下的人员数量
     */
    @Override
    public int getStaffCountByAgency(Long agency) {
        return staffDao.getStaffCountByAgency(agency);
    }

    @Override
    public Staff findStaffById(Long id) {

        return staffDao.findStaffById(id);
    }

    /**
     * 根据属性查询机构人员
     *
     * @return
     */
    @Override
    public List<Staff> findStaffByProperties(Map paramMap) {

        return staffDao.findStaffByProperties(paramMap);
    }

    /**
     * 更新领导
     *
     * @param paramMap
     * @return
     */
    @Override
    public boolean updateLeader(Map paramMap) {

        return staffDao.updateLeader(paramMap);
    }

    @Override
    public List<StaffVo> queryPrivStaffVoGeneral(Map<String, Object> paramMap) {
        return staffDao.getPrivStaffVoGeneral(paramMap);
    }

    @Override
    public Integer getStaffVoCountGeneral(Map<String, Object> paramMap) {
        return staffDao.getStaffVoCountGeneral(paramMap);
    }

    @Override
    public int updateStaffNew(StaffVo staff) {
        return staffDao.updateStaffNew(staff);
    }

    @Override
    public List<StaffVo> findStaffVoByProperties(Map paramMap) {
        return staffDao.findStaffVoByProperties(paramMap);
    }

}
